@extends('admin.layout')
@section('content')
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                商品管理
                <small>添加</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="#">商品管理</a></li>
                <li class="active">添加</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速添加商品</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{ url('admin/goods/insert') }}"  method='post' enctype="multipart/form-data">
                        	{{ csrf_field() }}
							
                            <div class="box-body">
                            @if(session('info'))

                            <div class="alert alert-danger alert-dismissable">
			                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
			                    <h4><i class="icon fa fa-ban"></i> 提示!</h4>
							<p>
							
								{{ session('info') }}
							@endif
							</p>
							</div>

                        	@if (count($errors) > 0)
	                        	<div class="alert alert-danger alert-dismissable">
			                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
			                    <h4><i class="icon fa fa-ban"></i> 警告!</h4>
			                     <ol>
								            @foreach ($errors->all() as $error)
								                <li>{{ $error }}</li>
								            @endforeach
								 </ol>
			                   
			                    </div>
		    
								@endif
                                <div class="form-group">
                                    <label for="exampleInputEmail1">商品名</label>
                                    <input type="text" name="name" class="form-control" value="{{ old('name') }}" id="exampleInputEmail1"
                                           placeholder="请输入6-18位商品名">
                                </div>

                                 <div class="form-group">
                                 <label for="exampleInputEmail1">分类</label>
                                    
                                    <select name='cate_id' class="form-control">
                                    <option value="0">根分类</option>
                                    @foreach($data as $cate)

                                        <option value="{{ $cate ->id }}">{{ $cate -> name }}</option>

                                    @endforeach
                                       
                                        
                                      
                                    </select>
                                </div>
                                
                               
								
								 <div class="form-group">
                                    <label for="exampleInputEmail1">价格</label>
                                    <input type="text" name="price" class="form-control" value="{{ old('price') }}" id="exampleInputEmail1"
                                           placeholder="请输入您的价格">
                                </div>

                                

                               <div class="form-group">
                                    <label for="exampleInputFile">商品图片</label>
                                    <input type="file" name='img' id="exampleInputFile">
                                    
                                </div>
                                
                                <div class="form-group">
                                    <label for="exampleInputFile">商品详情</label>
                                   <!-- 加载编辑器的容器 -->
                                    <script id="container" style="width:100%;height:400px;"  name="detail" type="text/plain"></script>
                                    <!-- 配置文件 -->
                                    <script type="text/javascript" src="{{ url('/ue/ueditor.config.js') }}"></script>
                                    <!-- 编辑器源码文件 -->
                                    <script type="text/javascript" src="{{ url('/ue/ueditor.all.js') }}"></script>
                                    <!-- 实例化编辑器 -->
                                    <script type="text/javascript">
                                        var ue = UE.getEditor('container');
                                    </script>
                                </div>





    
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">添加</button>
                                <button type="submit" class="btn btn-default">重置</button>
                            </div>

                        </form>
                    </div><!-- /.box -->

                
               
                </div><!--/.col (right) -->
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
@endsection